//
//  MainMenuScene.cpp
//  ___PROJECTNAME___
//
//  Created by ___FULLUSERNAME___ on ___DATE___.
//  Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//

#include "MainMenuScene.h"

#include "GameScene.h"
#include "Keys.h"


using namespace cocos2d;

namespace ___game_namespace___ {

////////////////////////////////////////////////////////
//
/** MainMenuScene
 * 
*/
////////////////////////////////////////////////////////

CCScene* MainMenuScene::scene()
{
	MainMenuScene *pRet = new MainMenuScene();
	CCAssert(pRet != NULL, NULL);
	if (pRet->init())
	{
		pRet->autorelease();
        return pRet;
	}
	else
	{
		CC_SAFE_DELETE(pRet)
		return NULL;
	}
}


MainMenuScene::~MainMenuScene()
{

}

bool MainMenuScene::init()
{
    //self init
    if (!CCScene::init() )
        return false;


    CCMenu* menu = CCMenu::node();
    menu->setAnchorPoint(CCPointZero);
    menu->setPosition(CCPointZero);
    menu->setContentSize(this->getContentSize());
    this->addChild(menu, 0);

    CCMenuItemFont::setFontSize(32);
    CCMenuItemFont::setFontName("Marker Felt");
    CCMenuItemFont* menuItem = CCMenuItemFont::itemFromString("Play", this, menu_selector(MainMenuScene::onPlay));
    menuItem->setAnchorPoint(ccp(0.5f, 0.5f));
    menuItem->setPosition(ccp(this->getContentSize().width/2.f, this->getContentSize().height/2.f));
    menu->addChild(menuItem, 0);

    return true;
}

void MainMenuScene::onPlay(CCObject* caller)
{
	CCDirector::sharedDirector()->replaceScene(GameScene::scene());
}

} // namespace ___game_namespace___
